Skip to content

Detect bytecode length mismatches#133

Merged
tamtamchik merged 10 commits intomainfrom
bytecode-check-fix
Feb 2, 2026
Merged

Detect bytecode length mismatches#133
tamtamchik merged 10 commits intomainfrom
bytecode-check-fix

Conversation

@TheDZhon
Copy link
Contributor

@TheDZhon TheDZhon commented Jan 29, 2026

Summary

  • Compile bytecode from GitHub sources using Etherscan compiler settings (v2 API via chain id)
  • Improve bytecode compare flow: report opcode/length mismatches without aborting the run
  • CI regression updates: include Dual Governance mainnet configs, pass ETHERSCAN token, and allow Escrow bytecode diff
  • Fix Hoodi V3Template constructor args (28‑param struct + expiry + max ratio)

Testing

  • poetry run pytest -q
  • poetry run diffyscan --hardhat-path hardhat_configs/hoodi_hardhat_config.ts -Y -E -G config_samples/ethereum/hoodi/vaults/hoodi_vaults_testnet_config.json [CI allowlist flags]
  • poetry run diffyscan --hardhat-path hardhat_configs/mainnet_hardhat_config.ts -Y -E -G config_samples/ethereum/mainnet/gualGovernance/dual_governance_mainnet_config.json --allow-bytecode-diff 0xd6A67636c05BeB5B4a5c90D408b03A63c4e39426

@TheDZhon TheDZhon marked this pull request as ready for review January 29, 2026 21:18
@TheDZhon TheDZhon requested review from a team as code owners January 29, 2026 21:18
@TheDZhon TheDZhon requested a review from avsetsin January 29, 2026 21:26
@TheDZhon TheDZhon requested a review from tamtamchik January 30, 2026 08:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the bytecode verification process by improving error handling, adding GitHub-based compilation, and updating configurations. The main purpose is to detect and report bytecode length mismatches without aborting the run, and to compile bytecode from GitHub sources using Etherscan compiler settings.

Changes:

  • Improved bytecode comparison to detect and report length/opcode mismatches as errors rather than aborting
  • Added functionality to compile bytecode from GitHub sources for bytecode comparison
  • Enhanced error handling to treat bytecode comparison failures as reportable diffs
  • Added stdin interactivity detection to skip prompts in CI/CD environments

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_binary_verifier.py New test file covering length mismatch detection, immutable-only diffs, and non-immutable differences
diffyscan/utils/binary_verifier.py Updated length mismatch handling to display diffs before raising errors, fixed checkpoint calculation for empty instruction lists, corrected opcode mismatch detection
diffyscan/diffyscan.py Added _build_github_solc_input to fetch sources from GitHub for compilation, updated exception handling to catch bytecode errors gracefully, added stdin.isatty() check for CI compatibility
config_samples/ethereum/mainnet/gualGovernance/*.json Added explorer_token_env_var and explorer_chain_id fields for Etherscan API v2 support
config_samples/ethereum/hoodi/vaults/hoodi_vaults_testnet_config.json Fixed V3Template constructor arguments with 28-address array plus expiry and max ratio parameters
.github/workflows/regression.yml Added Dual Governance mainnet config tests, included ETHERSCAN_TOKEN env var, added bytecode diff allowances for specific contracts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@tamtamchik tamtamchik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that sure about the allowed diffs in CI, will re-check and come back

@tamtamchik tamtamchik merged commit e0fbfc2 into main Feb 2, 2026
17 checks passed
@tamtamchik tamtamchik deleted the bytecode-check-fix branch February 2, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants